package com.woniuxy.micropromotionserver.promotionmag.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

@Mapper
public interface PromoAndGoodsMapper {
    /**
     * 1这是一个对中间表（促销单id和商品id的中间表）   加数据的
     * pid 促销单id
     * gid,商品id
     */
    @Insert("insert into t_promo_goods_info " +
            "(fk_promo_id,fk_goods_id)" +
            " values(#{pid},#{gid})" )
    int savePidAndGid(@Param("pid") Long pid, @Param("gid")Long gid);

    /**
     * 2 删除多条该促销单和商品的中间关系  根据促销单id
     * @return
     */
    @Delete("delete from t_promo_goods_info where fk_promo_id = #{pid}")
    int delPidAndGid(Long pid);

}
